package io_urfave

import (
	"fmt"

	"github.com/urfave/cli/v2"

	"clean/usecase"
	"clean/usecase/io/pb"
)

func Hello(app usecase.Input) *cli.Command {
	cmd := &cli.Command{
		Name:   "hello",
		Usage: "hello h",
		Flags:[]cli.Flag{
			&cli.StringFlag{
				Name:    "name",
				Value: "",
			},
		},
		Action: func(c *cli.Context) error {
			out := &pb.Output{}
			app.Hello(pb.Input{
				Msg: &pb.Input_InputHello{
					InputHello: &pb.InputHello{
						Name: c.String("name"),
					},
				},
			}, out)
			fmt.Println(out.GetOutputHello().Msg)
			return nil
		},
	}
	return cmd
}
